﻿using System;
using System.Diagnostics;

namespace MarkdEdit.Log
{
    public interface ILog
    {
        void Info(string msg, Exception ex = null);

        void Warn(string msg, Exception ex = null);

        void Error(string msg, Exception ex = null);

        void Debug(string msg, Exception ex = null);
    }

    internal static class ILogExtension
    {
        public static Type GetCallingType(this ILog log)
        {
            StackTrace st = new StackTrace(true);
            return st.GetFrame(2).GetMethod().DeclaringType;
        }
    }
}